AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
AddCSLuaFile("cl_pickteam.lua")
AddCSLuaFile("cl_scoreboard.lua")

include("shared.lua")

--PlayerModels
util.PrecacheModel( "models/player/odessa.mdl" )
util.PrecacheModel( "models/player/kleiner.mdl" )

--Print player connections to console
function GM:PlayerConnect( name, ip )
	print("Player: " .. name .. " had joined the game.")
end

--Announce admin connects
function GM:PlayerInitialSpawn( player )

	if(player:SteamID() == "STEAM_0:1:14968245") then
		PrintMessage(HUD_PRINTTALK, "Admin Black Mist has Connected")
	end
	
	if(player:SteamID() == "STEAM_0:0:19803895") then
		PrintMessage(HUD_PRINTTALK, "Admin Rektolisk has Connected")
	end

end

function GM:PlayerLoadout( player )

	player:Give( "weapon_crowbar" )
	
end

-- No player vs player damage
function GM:PlayerShouldTakeDamage( ply, attacker )

	if ( attacker:IsValid() && attacker:IsPlayer() ) then
		return cvars.Bool( "pz_playerdamage", true )
	end
	
	return true

end

--Chat commands
function chatCommand( ply, text, public )

    if (string.sub(text, 1, 15) == "/model kleiner") then
		ply:SetModel( "models/player/kleiner.mdl" )
        return(false) --Hides the command from chat
    end
	
	if (string.sub(text, 1, 15) == "/model odessa") then
		ply:SetModel( "models/player/odessa.mdl" )
        return(false) --Hides the command from chat
    end
	
	if (string.sub(text, 1, 13) == "/trail plasma") then
		local trail = util.SpriteTrail(ply, 3, Color(255,0,0), false, 15, 1, 4, 1/(15+1)*0.5, "trails/plasma.vmt")
        return(false) --Hides the command from chat
    end
	
end
hook.Add( "PlayerSay", "chatCommand", chatCommand );